package threadBaseUse;

/**
 * @Author: WanqingLiu
 * @Date: 2023/02/02/14:35
 * 测试守护线程
 */
public class testDaemon {

    public static void main(String[] args) {
        You you = new You();
        God god = new God();
        Thread thread = new Thread(god);
        thread.setDaemon(true);
        thread.start();
        new Thread(you).start();
    }

}

class You implements Runnable {
    @Override
    public void run() {
        for (int i=0; i<36500; i++){
            System.out.println("你开心的活着");
        }
    }
}
class God implements Runnable {
    @Override
    public void run() {
        while (true) {

            System.out.println("上帝保佑你");
        }
    }

}